package org.example.attendancesystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.attendancesystem.domain.AttendanceRecords;
import org.example.attendancesystem.service.AttendanceRecordsService;
import org.example.attendancesystem.mapper.AttendanceRecordsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author urts
* @description 针对表【attendance_records】的数据库操作Service实现
* @createDate 2025-04-12 10:01:34
*/
@Service
public class AttendanceRecordsServiceImpl extends ServiceImpl<AttendanceRecordsMapper, AttendanceRecords>
    implements AttendanceRecordsService{

    @Autowired
    private AttendanceRecordsMapper attendanceRecordsMapper;
    // 通过 sessionId 获取签到记录
    @Override
    public AttendanceRecords getBySessionId(Long sessionId) {
        QueryWrapper<AttendanceRecords> wrapper = new QueryWrapper<>();
        wrapper.eq("session_id", sessionId);  // 通过 session_id 查找记录
        return attendanceRecordsMapper.selectOne(wrapper);  // 查询符合条件的唯一记录
    }

}




